function debounce(callback, delay = 500) {
  let timer = null;
  return function () {
    clearTimeout(timer);
    timer = setTimeout(() => {
      callback.apply(this);
    }, delay);
  };
}

export default debounce;
